home *** CD-ROM | disk | FTP | other *** search
- Path: news.mindlink.net!news
- From: genew@mindlink.bc.ca (Gene Wirchenko)
- Newsgroups: comp.lang.c++,comp.lang.c,comp.std.c
- Subject: Re: Hungarian notation
- Date: Sat, 27 Jan 1996 08:32:27 GMT
- Organization: MIND LINK! - British Columbia, Canada
- Message-ID: <4eco1g$aih@fountain.mindlink.net>
- References: <30C40F77.53B5@swsbbs.com> <4d2ok0$69s@beach.and.nl> <4dtv3gINNo9u@keats.ugrad.cs.ubc.ca> <SPENCER.96Jan22113215@zorgon.ERA.COM> <4e1nd8$hv0@solutions.solon.com> <3104bfc8.132251392@nntp.ix.netcom.com> <dewar.822407919@schonberg> <3106260f.224013120@nntp.ix.netcom.com> <4e6oj9$o02@news.xmission.com> <31077335.52859072@nntp.ix.netcom.com> <JSA.96Jan25190824@organon.com> <310842ad.6002240@nntp.ix.netcom.com> <JSA.96Jan26175507@organon.com> <31098190.8106176@nntp.ix.netcom.com>
- NNTP-Posting-Host: line105.nwm.mindlink.net
- X-Newsreader: Forte Free Agent 1.0.82
-
- miker3@ix.netcom.com (Mike Rubenstein) wrote:
-
- >jsa@organon.com (Jon S Anthony) wrote:
-
- >NOTE: I've removed all groups from this posting except comp.lang.c
- >and comp.lang.c++ and have added cmp.std.c
-
- >Since I've added a new group, let me summarize a bit. The discussion
- >revolves around the result of converting a signed integral type to a
- >smaller type when the value in the original cannot be represented in
- >the new type.
-
- >I claim that ISO 6.2.1.2 requires that an implementation actually do
- >such a conversion. The implementor may choose the mapping. Beside
- >the usual throwing away of high order bits, possibilities include
- >always using the value 0, or the largest possible value for the new
- >type, or, even, a random value.
-
- Or even a random value for your system disk <G>.
-
- Implementation defined means implementation defined, not what you
- want it to mean. I agree that your interpretation sets out reasonable
- actions that might be performed. Please quote chapter and verse on
- where the Standard states that implementation defined actions must be
- "reasonable" (whatever the hell that is <G>).
-
- >However, I claim that a conversion is required -- the implementation
- >must come up with a value that can be represented in the new type and
- >use that. It may not do other things like, as one person claimed,
- >deleting the system disk even if such action is documented.
-
- Is your claim supported in the Standard? If it isn't, you're
- wasting your time. What if the conversion results in overflow?
-
- >> In article <310842ad.6002240@nntp.ix.netcom.com> miker3@ix.netcom.com (Mike Rubenstein) writes:
- >>
- >> > jsa@organon.com (Jon S Anthony) wrote:
- >> >
- >> > > In article <31077335.52859072@nntp.ix.netcom.com> miker3@ix.netcom.com (Mike Rubenstein) writes:
- >> > >
- >> > > > I think you're reading something into my post that isn't there.
- >> > > >
- >> > > > What am I reading into the standard that's not there? Nothing in my
- >> > > > post suggests that defining the result as always 0 is illegal. In
- >> > > > fact, it is clearly legal.
- >> > > >
- >> > > > But the standard does impose some restrictions on the definition. The
- >> > > > definition must specify that the subject type is converted to the
- >> > > > object type. It must not produce side-effects.
-
- Why are no side effects permitted? Chapter and verse, please.
-
- >> > > >
- >> > > > Please reread my post; I was responding to the statement that the
- >> > > > definition could be to delete the system disk. That is out of bounds
- >> > > > for the definition and I said so. I did not say that defining the
- >> > > > result to be 0 is out of bounds.
- >> > >
- >> > > Face it. You just plain got it wrong. Deleting the system disk is
- >> > > perfectly within bounds. Stupid, for sure, as no one in their right
- >> > > mind would use such a compiler, but perfectly legal.
- >> >
- >> > Please cite anything in the standard that supports your position. I
- >> > can find nothing in the standard that gives an implementation that
- >> > license.
-
- If "implementation defined" does not qualify as "that licence",
- what in your eyes would?
-
- >> >
- >> > Insults do not prove a point -- quotes from the standard do. I've
- >> > shown the passages that support my position.
- >>
- >> I don't see any insult here at all. Sorry if you took it that way.
- >>
- >> Here's the relevant passage yet again:
- >>
- >> When a value with integral type is demoted to a signed integer
- >> with smaller size or an unsigned integer is converted to its
- >> corresponding signed integer, if the value cannot be
- >> represented the result is implementation defined.
- >>
- >> Now, the problem is (as James Kanze has pointed out) that the term
- >> "result" which you believe to know the "correct" definition of, is not
- >> defined. Because of this it _could_ be taken as meaning "result of
- >> the computation". You take it as a given that it means "result of the
- >> expression", i.e., its value. But that is not clear, and so an
- >> interpretation given the former reading would indeed allow for
- >> virtually any sort of behavior as long as that behavior was
- >> documented. As James Kanze pointed out, a very _reasonable_
- >> interpretation given this reading of "result" would be to to signal
- >> (raise) an exception.
-
- Agreed and this is what is keeping this argument going, eh?
-
- >I've not seen Jame's post, but I look forward to seeing it.
-
- >But, I don't see how the standard permits throwing an exception. ISO
- >6.2 says
-
- > Several operators convert operand values from one type to
- > another automatically. This subclause specifies the result
- > required from such an implicit conversion, as well as those
- > that result from a cast operation (an explicit conversion).
-
- What if the conversion results in overflow?
-
- >It seems obvious to me that if one uses correctly a construction that
- >the standard says converts a value from one type to another, then the
- >implementation must convert the value from one type to another -- it
- >may not do other things. By definition (ISO 3.10)
- >implementation-defined behavior only applies to a correct program
- >construct and correct data.
-
- If it is impossible to convert due to sizing, then the "must" is
- rather silly, isn't it?
-
- Would not the normal situation (especially since the point hasn't
- been raised previously) imply that the conversion we want done applies
- to a correct program construct and correct data? Why would you assume
- anything else? You are permitted to answer that you may do as you
- please because your assumptions are implementation defined <G>.
-
- >I'm glad you intended no insult. I'm afraid I just don't react well
- >to ex cathedra statements that I am wrong, particularly when I have
- >taken care to give clear citations that I believe support my
- >position.
-
- Yes, but you keep saying "claim" and write as if you are the
- Right Hand of God. So what about your claims! If they can't be
- supported by the Standard, forget it. Schildt CLAIMS that void main()
- is ok.
-
- >Michael M Rubenstein
-
- Sincerely,
-
- Gene Wirchenko
-
- C Pronunciation Guide:
- y=x++; "wye equals ex plus plus semicolon"
- x=x++; "ex equals ex doublecross semicolon"
-
-